<%-- 
    Document   : edPerfil
    Created on : 09/12/2011, 09:57:16
    Author     : a968340
--%>

<%@page import="util.Util"%>
<%@page import="dao.DaoUsuario"%>
<%@page import="entidades.Usuario"%>
<%@page import="dao.DaoAdministrador"%>
<%@page import="entidades.Administrador"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <%
        Usuario u = (Usuario) request.getSession().getAttribute("usuario");
        if (u == null || !new DaoUsuario().list().contains(u)) {
            response.sendRedirect("login.jsp");
        }
    %>
    <body>
      <form id="formSendFile" name="form" action="ServletEdUsuario" method="POST" enctype="multipart/form-data">
            <p> Login: <input type="text" name="login" value="<%out.print(u.getLogin());%>" /> </p>
            <p> Nome: <input type="text" name="nome" value="<%out.print(u.getNome());%>" /> </p>
            <p> Senha: <input type="password" name="senha1" value="<%out.print(u.getSenha());%>" /> </p>
            <p> Confirma Senha: <input type="password" name="senha2" value="<%out.print(u.getSenha());%>" /> </p>
            <p> Data de Nascimento: <input type="text" name="dtNasc" value="<%out.print(Util.dateToString(u.getDtNasc()));%>" /> </p>
            <p> Foto: <input id="imagem" type="file" name="imagem" maxlength="60" /> </p>
            <%
                String erro = (String) request.getAttribute("erro");
                if (erro != null) {
                    out.println("<p>" + erro + "</p>");
                }
            %>
            <p> <input type="submit" value="Ok" name="cadastrar" /> </p>

        </form>  
    </body>
</html>

